From 438b8fa221a8333ea7330e7a039bb316b05385c8 Mon Sep 17 00:00:00 2001 From: "gm281@boulderdash.cl.cam.ac.uk" Date: Thu, 5 Aug 2004 16:40:56 +0000 Subject: [PATCH] bitkeeper revision 1.1153 (41126318o43x3YiPCk8UwYtIQ4XdtA) Fixes to the warping mechanism in BVT --- tools/python/xen/lowlevel/xc/xc.c | 2 +- tools/python/xen/xend/Args.py | 2 ++ tools/python/xen/xend/server/SrvDomain.py | 4 +-- tools/python/xen/xm/main.py | 2 +- xen/common/sched_bvt.c | 44 +++++++++++++---------- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index fc5bafd81b..4b5a426b55 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -445,7 +445,7 @@ static PyObject *pyxc_bvtsched_domain_set(PyObject *self, static char *kwd_list[] = { "dom", "mcuadv", "warpback", "warpvalue", "warpl", "warpu", NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiill", kwd_list, + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiiLL", kwd_list, &dom, &mcuadv, &warpback, &warpvalue, &warpl, &warpu) ) return NULL; diff --git a/tools/python/xen/xend/Args.py b/tools/python/xen/xend/Args.py index 8920a65d1b..3e16844f74 100644 --- a/tools/python/xen/xend/Args.py +++ b/tools/python/xen/xend/Args.py @@ -72,6 +72,8 @@ class Args: try: if type == 'int': val = int(v) + elif type == 'long': + val = long(v) elif type == 'str': val = str(v) elif type == 'sxpr': diff --git a/tools/python/xen/xend/server/SrvDomain.py b/tools/python/xen/xend/server/SrvDomain.py index 983b7e4320..8975148819 100644 --- a/tools/python/xen/xend/server/SrvDomain.py +++ b/tools/python/xen/xend/server/SrvDomain.py @@ -112,8 +112,8 @@ class SrvDomain(SrvDir): ['mcuadv', 'int'], ['warpback', 'int'], ['warpvalue', 'int'], - ['warpl', 'int'], - ['warpu', 'int']]) + ['warpl', 'long'], + ['warpu', 'long']]) val = fn(req.args, {'dom': self.dom.name}) return val diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index f331db9cd3..5fa8625413 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -497,7 +497,7 @@ class ProgBvt(Prog): def main(self, args): if len(args) != 7: self.err("%s: Invalid argument(s)" % args[0]) - v = map(int, args[1:7]) + v = map(long, args[1:7]) server.xend_domain_cpu_bvt_set(*v) xm.prog(ProgBvt) diff --git a/xen/common/sched_bvt.c b/xen/common/sched_bvt.c index 7c02c70e91..9f4278ea93 100644 --- a/xen/common/sched_bvt.c +++ b/xen/common/sched_bvt.c @@ -98,8 +98,9 @@ static inline int __task_on_runqueue(struct domain *d) static void warp_timer_fn(unsigned long pointer) { struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer; - -printk("--> Warp timer fired for %d\n", inf->domain->domain); + unsigned long flags; + + spin_lock_irqsave(&CPU_INFO(inf->domain->processor)->run_lock, flags); inf->warp = 0; /* unwarp equal to zero => stop warping */ if(inf->warpu == 0) @@ -110,7 +111,9 @@ printk("--> Warp timer fired for %d\n", inf->domain->domain); /* set unwarp timer */ inf->unwarp_timer.expires = NOW() + inf->warpu; + rem_ac_timer(&inf->unwarp_timer); add_ac_timer(&inf->unwarp_timer); + spin_unlock_irqrestore(&CPU_INFO(inf->domain->processor)->run_lock, flags); reschedule: cpu_raise_softirq(inf->domain->processor, SCHEDULE_SOFTIRQ); @@ -119,13 +122,16 @@ reschedule: static void unwarp_timer_fn(unsigned long pointer) { struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer; + unsigned long flags; -printk("---> UnWarp timer fired for %d\n", inf->domain->domain); + spin_lock_irqsave(&CPU_INFO(inf->domain->processor)->run_lock, flags); if(inf->warpback) { inf->warp = 1; cpu_raise_softirq(inf->domain->processor, SCHEDULE_SOFTIRQ); } + + spin_unlock_irqrestore(&CPU_INFO(inf->domain->processor)->run_lock, flags); } @@ -262,9 +268,6 @@ void bvt_wake(struct domain *d) inf->avt = CPU_SVT(cpu); /* Deal with warping here. */ - // TODO rewrite - //inf->warpback = 1; - //inf->warped = now; inf->evt = calc_evt(d, inf->avt); spin_unlock_irqrestore(&CPU_INFO(cpu)->run_lock, flags); @@ -323,7 +326,6 @@ void bvt_free_task(struct domain *p) */ static void bvt_do_block(struct domain *p) { - // TODO what when blocks? BVT_INFO(p)->warpback = 0; } /* Control the scheduler. */ @@ -371,16 +373,17 @@ int bvt_adjdom(struct domain *p, spin_lock_irqsave(&CPU_INFO(p->processor)->run_lock, flags); inf->mcu_advance = mcu_adv; - inf->warpback = warpback; // TODO - temporary - inf->warp = 1; + inf->warpback = warpback; + /* The warp should be the same as warpback */ + inf->warp = warpback; inf->warp_value = warpvalue; inf->warpl = warpl; inf->warpu = warpu; DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d" - "warpl=%lld, warpu=%lld\n", + "warpl=%lld, warpu=%lld, values(%lld, %lld)\n", p->domain, inf->mcu_advance, inf->warpback, inf->warp_value, - inf->warpl, inf->warpu); + inf->warpl, inf->warpu, warpl, warpu); spin_unlock_irqrestore(&CPU_INFO(p->processor)->run_lock, flags); } @@ -434,7 +437,9 @@ static task_slice_t bvt_do_schedule(s_time_t now) prev_inf->avt = calc_avt(prev, now); prev_inf->evt = calc_evt(prev, prev_inf->avt); - rem_ac_timer(&prev_inf->warp_timer); + if(prev_inf->warpback && prev_inf->warpl > 0) + rem_ac_timer(&prev_inf->warp_timer); + __del_from_runqueue(prev); if ( domain_runnable(prev) ) @@ -484,6 +489,14 @@ static task_slice_t bvt_do_schedule(s_time_t now) min_avt = p_inf->avt; } + if(next_inf->warp && next_inf->warpl > 0) + { + /* Set the timer up */ + next_inf->warp_timer.expires = now + next_inf->warpl; + /* Add it to the heap */ + add_ac_timer(&next_inf->warp_timer); + } + spin_unlock_irqrestore(&CPU_INFO(cpu)->run_lock, flags); /* Extract the domain pointers from the dom infos */ @@ -543,13 +556,6 @@ static task_slice_t bvt_do_schedule(s_time_t now) ASSERT(r_time >= ctx_allow); sched_done: - if(next_inf->warp && next_inf->warpl > 0) // TODO - already added? - { - /* Set the timer up */ - next_inf->warp_timer.expires = now + next_inf->warpl; - /* Add it to the heap */ - add_ac_timer(&next_inf->warp_timer); - } ret.task = next; ret.time = r_time; return ret; -- 2.30.2